#pragma once

#include <string>
#include <vector>

#include "RelationshipArgumentType.h"
#include "PatternType.h"
#include "TreeNode.h"

static const int MAX_PATTERNARGUMENTS = 3; // maximum number of arguments a pattern can have within the pattern-bracket

/*!
 PatternEntry is the data structure containing information in the format
 synonym - first argument type (INVALID_ARG if not a synonym) - first argument string - 
 expression arguments - perfect match requirements for each of these expressions - 
 pattern ifstmt(v, then, else)
*/ 
struct PatternEntry {
	std::string synonym; // patterns must definitely start with a synonym
	PatternType patternType; // type of pattern: PATTERN_ASSIGN, PATTERN_WHILE, PATTERN_IF
	std::vector<RelationshipArgumentType> argSynonymTypes; // within the pattern-bracket, each argument can be expressions/synonyms
	std::vector<std::string> args; // the string for each of those arguments in the pattern-bracket
	std::vector<TreeNode*> exprArguments; // within the pattern-bracket, there can be expression arguments
	std::vector<bool> perfectMatchRequirementVector; // does the argument in the pattern-bracket require a perfect match?

	bool operator== (const PatternEntry &p) const {
		if (synonym != p.synonym) return false;
		bool check = true;
		for (int i = 0; i < MAX_PATTERNARGUMENTS; i++) {
			if (argSynonymTypes[i] != p.argSynonymTypes[i]
				|| args[i] != p.args[i]
				|| exprArguments[i] != p.exprArguments[i]
				|| perfectMatchRequirementVector[i] != p.perfectMatchRequirementVector[i]) {
					check = false;
					break;
			}
		}
		return check;
	}
};